# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=evolution-ews
pkgver=3.40.4
pkgrel=1
pkgdesc="MS Exchange integration through Exchange Web Services"
url="https://wiki.gnome.org/Apps/Evolution/EWS"
arch=(x86_64)
license=(LGPL2.1)
depends=(libmspack evolution)
makedepends=(git intltool python cmake ninja systemd)
_commit=96f7f2e459f71d0c12d9d089754f48b728568b15  # tags/3.40.4^0
source=("git+https://gitlab.gnome.org/GNOME/evolution-ews.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^EVOLUTION_EWS_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  cmake -S $pkgname -B build -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIBEXEC_INSTALL_DIR=/usr/lib \
    -DSYSCONF_INSTALL_DIR=/etc
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
